import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

App.mpType = 'app'
//全局引入uview
import uView from "uview-ui"
Vue.use(uView)

//tabbar 
import tabbar from 'common/tabbar.js'
Vue.prototype.$tabbar = tabbar

//tools工具
import tools from 'common/Tool.js'
Vue.prototype.$tools = tools

// AES加密
import AES from '@/components/ar-aes/ar-aes.js'
Vue.prototype.AES = AES.AES

// vue-jsonp
import { VueJsonp } from 'vue-jsonp'
Vue.use(VueJsonp)
//router:https://hhyang.cn/src/router/start/quickstart.html
import { router, RouterMount } from './router.js'
Vue.use(router)

const app = new Vue({
  ...App
})
// http拦截器
import httpInterceptor from '@/common/http.interceptor.js'
Vue.use(httpInterceptor, app);

import httpApi from '@/common/http.api.js'
Vue.use(httpApi, app);

// 导入组件 loading加载
import store from "./store";
import toast from './components/toast/toast.vue'

// 注册组件
Vue.component('toast', toast)
Vue.prototype.$store = store;
function loading(tf) {
  setTimeout(() => {
    store.commit("switch_loading", tf)
  }, 500)
}
Vue.prototype.$loading = loading;

// #ifdef H5
RouterMount(app, router, '#app')
// #endif

// #ifndef H5
app.$mount();
// #endif
